//
//  BankCardCell.m
//  PPDL
//
//  Created by 王洋 on 2019/7/25.
//  Copyright © 2019 王洋. All rights reserved.
//

#import "BankCardCell.h"

@implementation BankCardCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
}

- (void)fillCellWithModel:(BankCardModel *)model {
    
    self.model = model;
    self.bankName.text = [NSString stringWithFormat:@"%@",model.bankName];
    self.cardType.text = [NSString stringWithFormat:@"%@",model.cardTypeName];
    self.cardID.text = [NSString stringWithFormat:@"%@",model.bankCardID];
    
    [self.selectDefaultBtn setImage:model.isDefault?[UIImage imageNamed:@"admire_bg"]:[UIImage imageNamed:@"empty_bg"] forState:UIControlStateNormal];
}

- (IBAction)selectDefaultClicked:(id)sender {

    self.model.isDefault = !self.model.isDefault;
    
    [self.selectDefaultBtn setImage:self.model.isDefault?[UIImage imageNamed:@"admire_bg"]:[UIImage imageNamed:@"empty_bg"]
                     forState:UIControlStateNormal];
    
    if (self.refreshItemModel) {
        self.refreshItemModel(self.model);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
